package com.taobao.txc.common.c;

import io.netty.buffer.ByteBuf;
import java.nio.ByteBuffer;

public abstract class a
  extends F
  implements q
{
  int a;
  public ByteBuffer b = ByteBuffer.allocate(512);
  private String c;
  
  public int a()
  {
    return this.a;
  }
  
  public void a(int paramInt)
  {
    this.a = paramInt;
  }
  
  public String b()
  {
    return this.c;
  }
  
  public void a(String paramString)
  {
    this.c = paramString;
  }
  
  public byte[] c()
  {
    this.b.put((byte)this.a);
    if (this.a != 1) {
      if (b() != null)
      {
        String str;
        if (b().length() > 128) {
          str = b().substring(0, 128);
        } else {
          str = b();
        }
        byte[] arrayOfByte = str.getBytes(j);
        if ((arrayOfByte.length > 400) && (b().length() > 64))
        {
          str = b().substring(0, 64);
          arrayOfByte = str.getBytes(j);
        }
        this.b.putShort((short)arrayOfByte.length);
        if (arrayOfByte.length > 0) {
          this.b.put(arrayOfByte);
        }
      }
      else
      {
        this.b.putShort((short)0);
      }
    }
    return null;
  }
  
  public void a(ByteBuffer paramByteBuffer)
  {
    a(paramByteBuffer.get());
    if (this.a != 1)
    {
      int i = paramByteBuffer.getShort();
      if (i > 0)
      {
        byte[] arrayOfByte = new byte[i];
        paramByteBuffer.get(arrayOfByte);
        a(new String(arrayOfByte, j));
      }
    }
  }
  
  public boolean a(ByteBuf paramByteBuf)
  {
    int i = paramByteBuf.readableBytes();
    if (i < 1) {
      return false;
    }
    a(paramByteBuf.readByte());
    i--;
    if (this.a != 1)
    {
      if (i < 2) {
        return false;
      }
      int j = paramByteBuf.readShort();
      i -= 2;
      if (i < j) {
        return false;
      }
      if (j > 0)
      {
        byte[] arrayOfByte = new byte[j];
        paramByteBuf.readBytes(arrayOfByte);
        a(new String(arrayOfByte, j));
      }
    }
    return true;
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.common.c.a
 * JD-Core Version:    0.7.0.1
 */